package com.time.workbench.efficient.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.time.workbench.core.util.AuthUtil;
import com.time.workbench.efficient.entity.bo.Application;
import com.time.workbench.efficient.entity.bo.ApplicationServer;
import com.time.workbench.efficient.entity.bo.DeployRecord;
import com.time.workbench.efficient.entity.dto.ApplicationPageReq;
import com.time.workbench.efficient.entity.dto.SetApplicationServerReq;
import com.time.workbench.efficient.service.ApplicationServerService;
import com.time.workbench.efficient.service.ApplicationService;
import com.time.workbench.efficient.service.DeployRecordService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 应用管理
 *
 * @description: 应用管理
 * @menu 应用管理
 */
@RestController
@RequestMapping("/api/efficient/deploy")
@Slf4j
@RequiredArgsConstructor
public class DeployController {

    @Autowired
    private DeployRecordService deployRecordService;


    /**
     * 根据部署code查询详情
     *
     * @param deployCode
     * @return
     */
    @GetMapping("/getDeployByCode/{deployCode}")
    public DeployRecord getDeployByCode(@PathVariable("deployCode") String deployCode) {
        return deployRecordService.getDeployByCode(deployCode);
    }

    /**
     * 根据日志查看code
     *
     * @param deployCode
     * @return
     */
    @GetMapping("/getLogByCode/{deployCode}")
    public List<String> getLogByCode(@PathVariable("deployCode") String deployCode) {
        return deployRecordService.getLogByCode(deployCode);
    }
}
